<?php

// +---------------------------------------------+
// |     Copyright  2010 - 2018 InterPhoto       |
// |     http://www.weentech.com                 |
// |     This file may not be redistributed.     |
// +---------------------------------------------+


include('includes/InterPhoto.Core.php');

if($islogined){
	if(strstr($_POST['thisurl'], 'login')){
		header("Location: ".GetUrl('mydesk.php')); exit();
	}else{
		header("Location: ".$_POST['thisurl']); exit();
	}
}elseif($userinfo['userid']){
	header("Location: ".GetUrl('mydesk.php'));
	exit();
}

$smarty = new InterPhoto;
$pagenav = '<a href="'.GetUrl('index.php').'">'.$langs['home'].'</a> '.$langs['nav'].' <a href="'.GetUrl('login.php').'">'.$langs['signup'].'</a>';

if(!$mainsettings['siteAllowGuest']){
	$smarty->assign('loginforview', $sys_langs['loginforview']);
}else{
	$getimages = $DB->query("SELECT i.imageid, i.path, i.filename, i.title FROM " . TABLE_PREFIX . "images i LEFT JOIN  " . TABLE_PREFIX . "categories c ON (c.categoryid = i.categoryid) WHERE (i.usergroupids = 'all' OR i.usergroupids LIKE '%(".$userinfo['groupid'].")%') AND i.actived = 1 AND c.actived = 1 ORDER BY i.imageid DESC LIMIT 10");

	$images = $DB->getrows($getimages);

	$smarty->assign('images', $images);
}

$smarty->assign('pagenav', $pagenav);
$smarty->assign('userinfo', $userinfo);
$smarty->assign('pagetitle', $langs['signup']. ' - ' .$mainsettings['siteTitle']);

$smarty->interPlay('login.tpl');

?>